﻿// ***********************************************************************
// Assembly         : TCPServerSocket
// Author           : yubao
// Created          : 07-18-2014
//
// Last Modified By : yubao
// Last Modified On : 07-30-2014
// ***********************************************************************
// <copyright file="ClientConnectionPool.cs" company="www.cnblogs.com/dotcpp">
//     Copyright (c) www.cnblogs.com/dotcpp. All rights reserved.
// </copyright>
// <summary>当前在线的TCP客户队列</summary>
// ***********************************************************************


using System.Collections;

namespace TCPServerSocket
{
    public class ClientConnectionPool
    {
        private readonly Queue _syncdQ = Queue.Synchronized(new Queue());

        public void Enqueue(ClientHandler client)
        {
            _syncdQ.Enqueue(client);
        }

        public ClientHandler Dequeue()
        {
            return (ClientHandler)(_syncdQ.Dequeue());
        }

        public int Count
        {
            get { return _syncdQ.Count; }
        }

        public object SyncRoot
        {
            get { return _syncdQ.SyncRoot; }
        }

        public IEnumerator GetEnumerator()
        {
            return _syncdQ.GetEnumerator();
        }

    } 

}